package pfc;

import com.itextpdf.text.BadElementException;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Chapter;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.PageSize;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Section;
import com.itextpdf.text.pdf.PdfWriter;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author <Mejico, Rocío; Mignola, Natalia; Ordoñez, Agustina>
 */
public class PDF {

    private static Font catFont = new Font(Font.FontFamily.HELVETICA, 48, Font.BOLD, BaseColor.BLACK); //titulo principal
    private static Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.BOLD);//titulos de cada capítulo
    private static Font blueFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD, BaseColor.BLUE);//nivel 1 y 2
    private static Font darkGreyFont = new Font(Font.FontFamily.TIMES_ROMAN, 16, Font.BOLD, BaseColor.DARK_GRAY);//nivel 3
    private static Font greyFont = new Font(Font.FontFamily.TIMES_ROMAN,16, Font.BOLD, BaseColor.GRAY);//nivel 4

    public void guardarPDF(File f, Vector datos) {
        try {

            OutputStream file = new FileOutputStream(new File(f.getPath() + ".pdf"));

            Document document = new Document(PageSize.A4);
            PdfWriter.getInstance(document, file);
            document.open();

            this.metaDatos(document);

            //Contenido del documento
            this.tituloDocumento(document);
            this.imagenDocumento(document);
            this.contenidoDocumento(document, datos);

            document.close();
            file.close();

        } catch (Exception e) {

            e.printStackTrace();
        }
    }

    private void metaDatos(Document document) {
        //MetaDatos
        document.addAuthor("Mejico - Mignola - Ordoñez"); //acá debería ir el nombre del autor.
        document.addSubject("ERS");
        document.addTitle("ERS - Especificación de Requerimientos de Software");
        document.addCreationDate();
    }

    private void tituloDocumento(Document document) throws DocumentException {

        Paragraph titulo1 = new Paragraph("ERS", catFont);
        titulo1.setAlignment(Paragraph.ALIGN_CENTER);
        document.add(titulo1);
        Paragraph titulo2 = new Paragraph("Especificación de Requerimientos de Software", catFont);
        titulo2.setAlignment(titulo2.ALIGN_CENTER);
        document.add(titulo2);
    }

    @SuppressWarnings("static-access")
    private void imagenDocumento(Document document) {
        try {
            Image image = Image.getInstance("src/Imagenes/OBFRE.jpg");
            image.setAlignment(image.ALIGN_CENTER);
            document.add(image);

        } catch (DocumentException ex) {
            Logger.getLogger(PDF.class.getName()).log(Level.SEVERE, null, ex);
        } catch (MalformedURLException ex) {
            Logger.getLogger(PDF.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(PDF.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void contenidoDocumento(Document document, Vector datos) throws BadElementException, DocumentException {
        // Capitulo principal
        Chapter capitulo1 = new Chapter(new Paragraph("Introducción", subFont), 1);

        Paragraph intro = new Paragraph(datos.get(0).toString());
        intro.setIndentationLeft(10);
        capitulo1.add(intro);
//-------------------------------------------------------------------------------------------//
        Paragraph prop = new Paragraph("Propósito", blueFont);
        prop.setIndentationLeft(10);
        capitulo1.addSection(prop, 2); //esto aparece como 1.1

        Paragraph datosPro = new Paragraph(datos.get(1).toString());
        datosPro.setIndentationLeft(20);
        capitulo1.add(datosPro);
//-------------------------------------------------------------------------------------------//
        Paragraph alcance = new Paragraph("Alcance", blueFont);
        alcance.setIndentationLeft(10);
        capitulo1.addSection(alcance, 2);

        Paragraph datosAlcance = new Paragraph(datos.get(2).toString());
        datosAlcance.setIndentationLeft(20);
        capitulo1.add(datosAlcance);
//-------------------------------------------------------------------------------------------//
        Paragraph dAa = new Paragraph("Definiciones, acrónimos y abreviaciones", blueFont);
        dAa.setIndentationLeft(10);
        capitulo1.addSection(dAa, 2);

        Paragraph datosDAA = new Paragraph(datos.get(3).toString());
        datosDAA.setIndentationLeft(20);
        capitulo1.add(datosDAA);
//-------------------------------------------------------------------------------------------//
        Paragraph ref = new Paragraph("Referencias", blueFont);
        ref.setIndentationLeft(10);
        capitulo1.addSection(ref, 2);

        Paragraph datosRef = new Paragraph(datos.get(4).toString());
        datosRef.setIndentationLeft(20);
        capitulo1.add(datosRef);
//-------------------------------------------------------------------------------------------//
        Paragraph vis = new Paragraph("Vision", blueFont);
        vis.setIndentationLeft(10);
        capitulo1.addSection(vis, 2);

        Paragraph datosVis = new Paragraph(datos.get(5).toString());
        datosVis.setIndentationLeft(20);
        capitulo1.add(datosVis);

        document.add(capitulo1);

//CAPITULO 2
/********************************************************************************************/
        Chapter capitulo2 = new Chapter(new Paragraph("Descripción General", subFont), 2);
        Paragraph descGral = new Paragraph(datos.get(6).toString());
        descGral.setIndentationLeft(10);
        capitulo2.add(descGral);
//-------------------------------------------------------------------------------------------//
        Paragraph prodPersp = new Paragraph("Perspectiva del producto", blueFont);
        prodPersp.setIndentationLeft(10);
        capitulo2.addSection(prodPersp, 2);

        Paragraph datosPersProd = new Paragraph(datos.get(7).toString());
        datosPersProd.setIndentationLeft(20);
        capitulo2.add(datosPersProd);
//-------------------------------------------------------------------------------------------//
        Paragraph prodFunc = new Paragraph("Funciones del producto", blueFont);
        prodFunc.setIndentationLeft(10);
        capitulo2.addSection(prodFunc, 2);

        Paragraph datosProdFunc = new Paragraph(datos.get(8).toString());
        datosProdFunc.setIndentationLeft(20);
        capitulo2.add(datosProdFunc);
//-------------------------------------------------------------------------------------------//
        Paragraph carUser = new Paragraph("Características del Usuario", blueFont);
        carUser.setIndentationLeft(10);
        Section carU = capitulo2.addSection(carUser, 2);
//------------------------------------*********----------------------------------------------//
        Paragraph nivelEduc = new Paragraph("Nivel educacional", blueFont);
        nivelEduc.setIndentationLeft(25);
        carU.addSection(nivelEduc, 3);

        Paragraph datosNivelEduc = new Paragraph(datos.get(9).toString());
        datosNivelEduc.setIndentationLeft(30);
        carU.add(datosNivelEduc);
//------------------------------------*********----------------------------------------------//
        Paragraph exp = new Paragraph("Experiencia", blueFont);
        exp.setIndentationLeft(25);
        carU.addSection(exp, 3);

        Paragraph datosExp = new Paragraph(datos.get(10).toString());
        datosExp.setIndentationLeft(30);
        carU.add(datosExp);
//------------------------------------*********----------------------------------------------//
        Paragraph expT = new Paragraph("Experiencia Tecnica", blueFont);
        expT.setIndentationLeft(25);
        carU.addSection(expT, 3);

        Paragraph datosExpTec = new Paragraph(datos.get(11).toString());
        datosExpTec.setIndentationLeft(30);
        carU.add(datosExpTec);
//-------------------------------------------------------------------------------------------//
        Paragraph rest = new Paragraph("Restricciones", blueFont);
        rest.setIndentationLeft(10);
        Section restric = capitulo2.addSection(rest, 2);
//------------------------------------*********----------------------------------------------//
        Paragraph funAud = new Paragraph("Función de Auditoria", blueFont);
        funAud.setIndentationLeft(25);
        restric.addSection(funAud, 3);

        Paragraph datosFunAud = new Paragraph(datos.get(12).toString());
        datosFunAud.setIndentationLeft(35);
        restric.add(datosFunAud);
//------------------------------------*********----------------------------------------------//
        Paragraph funCont = new Paragraph("Función de Control", blueFont);
        funCont.setIndentationLeft(25);
        restric.addSection(funCont, 3);

        Paragraph datosFunCont = new Paragraph(datos.get(13).toString());
        datosFunCont.setIndentationLeft(35);
        restric.add(datosFunCont);
//------------------------------------*********----------------------------------------------//
        Paragraph crit = new Paragraph("Criticidad de la aplicación", blueFont);
        crit.setIndentationLeft(25);
        restric.addSection(crit, 3);

        Paragraph datosCrit = new Paragraph(datos.get(14).toString());
        datosCrit.setIndentationLeft(35);
        restric.add(datosCrit);
//------------------------------------*********----------------------------------------------//
        Paragraph limit = new Paragraph("Limitación del Hardware", blueFont);
        limit.setIndentationLeft(25);
        restric.addSection(limit, 3);

        Paragraph datosLimit = new Paragraph(datos.get(15).toString());
        datosLimit.setIndentationLeft(35);
        restric.add(datosLimit);
//------------------------------------*********----------------------------------------------//
        Paragraph maxLeng = new Paragraph("Máximo Orden del lenguaje de Requerimientos", blueFont);
        maxLeng.setIndentationLeft(25);
        restric.addSection(maxLeng, 3);

        Paragraph datosLeng = new Paragraph(datos.get(16).toString());
        datosLeng.setIndentationLeft(35);
        restric.add(datosLeng);
//------------------------------------*********----------------------------------------------//
        Paragraph IA = new Paragraph("Interface a otra aplicación", blueFont);
        IA.setIndentationLeft(25);
        restric.addSection(IA, 3);

        Paragraph datosInter = new Paragraph(datos.get(17).toString());
        datosInter.setIndentationLeft(35);
        restric.add(datosInter);
//------------------------------------*********----------------------------------------------//
        Paragraph op = new Paragraph("Operación paralela", blueFont);
        op.setIndentationLeft(25);
        restric.addSection(op, 3);

        Paragraph datosOp = new Paragraph(datos.get(18).toString());
        datosOp.setIndentationLeft(35);
        restric.add(datosOp);
//------------------------------------*********----------------------------------------------//
        Paragraph polit = new Paragraph("Política regulatoria", blueFont);
        polit.setIndentationLeft(25);
        restric.addSection(polit, 3);

        Paragraph datosPolit = new Paragraph(datos.get(19).toString());
        datosPolit.setIndentationLeft(35);
        restric.add(datosPolit);
//------------------------------------*********----------------------------------------------//
        Paragraph reqConf = new Paragraph("Requerimiento de confiabilidad", blueFont);
        reqConf.setIndentationLeft(25);
        restric.addSection(reqConf, 3);

        Paragraph datosReqConf = new Paragraph(datos.get(20).toString());
        datosReqConf.setIndentationLeft(35);
        restric.add(datosReqConf);
//------------------------------------*********----------------------------------------------//
        Paragraph consSeg = new Paragraph("Consideración de seguridad", blueFont);
        consSeg.setIndentationLeft(25);
        restric.addSection(consSeg, 3);

        Paragraph datosConsSeg = new Paragraph(datos.get(21).toString());
        datosConsSeg.setIndentationLeft(35);
        restric.add(datosConsSeg);
//------------------------------------*********----------------------------------------------//
        Paragraph senProt = new Paragraph("Señal de saludo del protocolo", blueFont);
        senProt.setIndentationLeft(25);
        restric.addSection(senProt, 3);

        Paragraph datosSenProt = new Paragraph(datos.get(22).toString());
        datosSenProt.setIndentationLeft(35);
        restric.add(datosSenProt);
//-------------------------------------------------------------------------------------------//
        Paragraph asunYdep = new Paragraph("Asunciones y Dependencias", blueFont);
        asunYdep.setIndentationLeft(10);
        capitulo2.addSection(asunYdep, 2);
        
        Paragraph datosAsunYdep = new Paragraph(datos.get(23).toString());
        datosAsunYdep.setIndentationLeft(20);
        capitulo2.add(datosAsunYdep);

        document.add(capitulo2);

//CAPITULO 3
/********************************************************************************************/
        Chapter capitulo3 = new Chapter(new Paragraph("Especificación de Requerimientos", subFont), 3);
        Paragraph reqSW = new Paragraph("Requerimientos de Software", blueFont);
        reqSW.setIndentationLeft(10);
        Section reqSWS = capitulo3.addSection(reqSW, 3);

        Paragraph restricDis = new Paragraph("Restricciones de diseño", blueFont);
        restricDis.setIndentationLeft(25);
        Section reqDS = reqSWS.addSection(restricDis, 3);
//------------------------------------*********----------------------------------------------//
        Paragraph aplicAsoc = new Paragraph("Aplicaciones asociadas", darkGreyFont);
        aplicAsoc.setIndentationLeft(30);
        reqDS.addSection(aplicAsoc, 4);

        Paragraph datosAplicAsoc = new Paragraph(datos.get(24).toString());
        datosAplicAsoc.setIndentationLeft(35);
        reqDS.add(datosAplicAsoc);
//------------------------------------*********----------------------------------------------//
        Paragraph aFe = new Paragraph("Ambiente Físico esperado", darkGreyFont);
        aFe.setIndentationLeft(30);
        reqDS.addSection(aFe, 4);

        Paragraph datosAFe = new Paragraph(datos.get(25).toString());
        datosAFe.setIndentationLeft(35);
        reqDS.add(datosAFe);
//------------------------------------*********----------------------------------------------//
        Paragraph est = new Paragraph("Estandares", darkGreyFont);
        est.setIndentationLeft(30);
        reqDS.addSection(est, 4);

        Paragraph datosEst = new Paragraph(datos.get(26).toString());
        datosEst.setIndentationLeft(35);
        reqDS.add(datosEst);
//------------------------------------*********----------------------------------------------//
        Paragraph aTe = new Paragraph("Ambiente Tecnológico esperado", darkGreyFont);
        aTe.setIndentationLeft(30);
        reqDS.addSection(aTe, 4);

        Paragraph datosATe = new Paragraph(datos.get(27).toString());
        datosATe.setIndentationLeft(35);
        reqDS.add(datosATe);
//--------------------------------------------------------------------------------------------//
        Paragraph reqIe = new Paragraph("Requerimientos de la interfaz externa", blueFont);
        reqIe.setIndentationLeft(25);
        Section reqIE = reqSWS.addSection(reqIe,3);
//------------------------------------*********----------------------------------------------//
        Paragraph iCom = new Paragraph("Intefaces de comunicación", darkGreyFont);
        iCom.setIndentationLeft(30);
        reqIE.addSection(iCom, 4);

        Paragraph datosIcom = new Paragraph(datos.get(28).toString());
        datosIcom.setIndentationLeft(35);
        reqIE.add(datosIcom);
//------------------------------------*********----------------------------------------------//
        Paragraph iHw = new Paragraph("Intefaces de Hardware", darkGreyFont);
        iHw.setIndentationLeft(30);
        reqIE.addSection(iHw, 4);

        Paragraph datosIhw = new Paragraph(datos.get(29).toString());
        datosIhw.setIndentationLeft(35);
        reqIE.add(datosIhw);
//------------------------------------*********----------------------------------------------//
        Paragraph iSw = new Paragraph("Intefaces de Software", darkGreyFont);
        iSw.setIndentationLeft(30);
        reqIE.addSection(iSw, 4);

        Paragraph datosIsw = new Paragraph(datos.get(30).toString());
        datosIsw.setIndentationLeft(35);
        reqIE.add(datosIsw);
//------------------------------------*********----------------------------------------------//
        Paragraph iU = new Paragraph("Intefaces de Usuario", darkGreyFont);
        iU.setIndentationLeft(30);
        reqIE.addSection(iU, 4);

        Paragraph datosIU = new Paragraph(datos.get(31).toString());
        datosIU.setIndentationLeft(35);
        reqIE.add(datosIU);
//--------------------------------------------------------------------------------------------//
        Paragraph reqFunc = new Paragraph("Requerimientos Funcionales", blueFont);
        reqFunc.setIndentationLeft(25);
        reqSWS.addSection(reqFunc, 3);

        Paragraph datosRf = new Paragraph(datos.get(32).toString());
        datosRf.setIndentationLeft(30);
        reqSWS.add(datosRf);
//--------------------------------------------------------------------------------------------//
        Paragraph oReq = new Paragraph("Otros Requerimientos", blueFont);
        oReq.setIndentationLeft(25);
        Section oR  = reqSWS.addSection(oReq,3);
//------------------------------------*********----------------------------------------------//
        Paragraph da = new Paragraph("Requerimientos de apariencia", darkGreyFont);
        da.setIndentationLeft(30);
        oR.addSection(da, 4);

        Paragraph datosDa = new Paragraph(datos.get(33).toString());
        datosDa.setIndentationLeft(35);
        oR.add(datosDa);
//------------------------------------*********----------------------------------------------//
        Paragraph h = new Paragraph("Requerimientos Heredados", darkGreyFont);
        h.setIndentationLeft(30);
        oR.addSection(h, 4);

        Paragraph datosH = new Paragraph(datos.get(34).toString());
        datosH.setIndentationLeft(35);
        oR.add(datosH);
//------------------------------------*********----------------------------------------------//
        Paragraph pC = new Paragraph("Requerimientos Político - Culturales", darkGreyFont);
        pC.setIndentationLeft(30);
        oR.addSection(pC, 4);

        Paragraph datosPc = new Paragraph(datos.get(35).toString());
        datosPc.setIndentationLeft(35);
        oR.add(datosPc);
//------------------------------------*********----------------------------------------------//
        Paragraph u = new Paragraph("Requerimientos de Uso", darkGreyFont);
        u.setIndentationLeft(30);
        oR.addSection(u, 4);

        Paragraph datosU = new Paragraph(datos.get(36).toString());
        datosU.setIndentationLeft(35);
        oR.add(datosU);
//--------------------------------------------------------------------------------------------//
        Paragraph reqP = new Paragraph("Requerimientos de Performance", blueFont);
        reqP.setIndentationLeft(25);
        Section rP = reqSWS.addSection(reqP,3);
//------------------------------------*********----------------------------------------------//
        Paragraph reqE = new Paragraph("Requerimientos de exactitud", darkGreyFont);
        reqE.setIndentationLeft(30);
        rP.addSection(reqE, 4);

        Paragraph datosReqE = new Paragraph(datos.get(37).toString());
        datosReqE.setIndentationLeft(35);
        rP.add(datosReqE);
//------------------------------------*********----------------------------------------------//
        Paragraph c = new Paragraph("Requerimientos de capacidad", darkGreyFont);
        c.setIndentationLeft(30);
        rP.addSection(c, 4);

        Paragraph datosC = new Paragraph(datos.get(38).toString());
        datosC.setIndentationLeft(35);
        rP.add(datosC);
//------------------------------------*********----------------------------------------------//
        Paragraph cS = new Paragraph("Requerimientos Críticos de Seguridad", darkGreyFont);
        cS.setIndentationLeft(30);
        rP.addSection(cS, 4);

        Paragraph datosCs = new Paragraph(datos.get(39).toString());
        datosCs.setIndentationLeft(35);
        rP.add(datosCs);
//------------------------------------*********----------------------------------------------//
        Paragraph v = new Paragraph("Requerimientos de velocidad", darkGreyFont);
        v.setIndentationLeft(30);
        rP.addSection(v, 4);

        Paragraph datosV = new Paragraph(datos.get(40).toString());
        datosV.setIndentationLeft(35);
        rP.add(datosV);
//--------------------------------------------------------------------------------------------//
        Paragraph atribSW = new Paragraph("Atributos del Sistema de Software", blueFont);
        atribSW.setIndentationLeft(25);
        Section aSS = reqSWS.addSection(atribSW,3);
//------------------------------------*********----------------------------------------------//
        Paragraph disp = new Paragraph("Disponibilidad", darkGreyFont);
        disp.setIndentationLeft(30);
        aSS.addSection(disp, 4);

        Paragraph datosDisp = new Paragraph(datos.get(41).toString());
        datosDisp.setIndentationLeft(35);
        aSS.add(datosDisp);
//------------------------------------*********----------------------------------------------//
        Paragraph port = new Paragraph("Portabilidad", darkGreyFont);
        port.setIndentationLeft(30);
        aSS.addSection(port, 4);

        Paragraph datosPort = new Paragraph(datos.get(42).toString());
        datosPort.setIndentationLeft(35);
        aSS.add(datosPort);
//------------------------------------*********----------------------------------------------//
        Paragraph fiab = new Paragraph("Confiabilidad", darkGreyFont);
        fiab.setIndentationLeft(30);
        aSS.addSection(fiab, 4);

        Paragraph datosFiab = new Paragraph(datos.get(43).toString());
        datosFiab.setIndentationLeft(35);
        aSS.add(datosFiab);
//------------------------------------*********----------------------------------------------//
        Paragraph segu = new Paragraph("Seguridad", darkGreyFont);
        segu.setIndentationLeft(30);
        Section seg = aSS.addSection(segu, 4);

        Paragraph confi = new Paragraph("Confidencialidad", greyFont);
        confi.setIndentationLeft(40);
        seg.addSection(confi, 5);

        Paragraph datosConfi = new Paragraph(datos.get(44).toString());
        datosConfi.setIndentationLeft(45);
        seg.add(datosConfi);
//------------------------------------*********----------------------------------------------//
        Paragraph sop = new Paragraph("Soporte", darkGreyFont);
        sop.setIndentationLeft(30);
        aSS.addSection(sop, 4);

        Paragraph datosSop = new Paragraph(datos.get(45).toString());
        datosSop.setIndentationLeft(35);
        aSS.add(datosSop);
//-------------------------------------------------------------------------------------------//
        Paragraph reqSist = new Paragraph("Requerimientos de Sistema", blueFont);
        reqSist.setIndentationLeft(10);
        Section reqSistem = capitulo3.addSection(reqSist, 3);
//-------------------------------------------------------------------------------------------//
        Paragraph gestI = new Paragraph("Gestión de la información", blueFont);
        gestI.setIndentationLeft(25);
        Section gesIn = reqSistem.addSection(gestI, 3);
        
        Paragraph infoConf = new Paragraph("Información Confidencial", darkGreyFont);
        infoConf.setIndentationLeft(30);
        gesIn.addSection(infoConf, 4);

        Paragraph datosInfoConf = new Paragraph(datos.get(46).toString());
        datosInfoConf.setIndentationLeft(35);
        gesIn.add(datosInfoConf);
//------------------------------------*********----------------------------------------------//
        Paragraph interEDI = new Paragraph("Intercambio EDI", darkGreyFont);
        interEDI.setIndentationLeft(30);
        gesIn.addSection(interEDI, 4);

        Paragraph datosInterEDI = new Paragraph(datos.get(47).toString());
        datosInterEDI.setIndentationLeft(35);
        gesIn.add(datosInterEDI);
//--------------------------------------------------------------------------------------------//
        Paragraph fis = new Paragraph("Físicos", blueFont);
        fis.setIndentationLeft(25);
        Section fisic = reqSistem.addSection(fis, 3);
//------------------------------------*********----------------------------------------------//
        Paragraph adap = new Paragraph("Adaptabilidad", darkGreyFont);
        adap.setIndentationLeft(30);
        fisic.addSection(adap, 4);

        Paragraph datosAdap = new Paragraph(datos.get(48).toString());
        datosAdap.setIndentationLeft(35);
        fisic.add(datosAdap);
//------------------------------------*********----------------------------------------------//
        Paragraph construc = new Paragraph("Construcción", darkGreyFont);
        construc.setIndentationLeft(30);
        fisic.addSection(construc, 4);

        Paragraph datosConstruc = new Paragraph(datos.get(49).toString());
        datosConstruc.setIndentationLeft(35);
        fisic.add(datosConstruc);
//------------------------------------*********----------------------------------------------//
        Paragraph durab = new Paragraph("Durabilidad", darkGreyFont);
        durab.setIndentationLeft(30);
        fisic.addSection(durab, 4);

        Paragraph datosDurab = new Paragraph(datos.get(50).toString());
        datosDurab.setIndentationLeft(35);
        fisic.add(datosDurab);
//------------------------------------*********----------------------------------------------//
        Paragraph cMa = new Paragraph("Condiciones del medioambiente", darkGreyFont);
        cMa.setIndentationLeft(30);
        fisic.addSection(cMa, 4);

        Paragraph datosCmA = new Paragraph(datos.get(51).toString());
        datosCmA.setIndentationLeft(35);
        fisic.add(datosCmA);
//--------------------------------------------------------------------------------------------//
        Paragraph rYp = new Paragraph("Regulaciones y Políticas", blueFont);
        rYp.setIndentationLeft(25);
        reqSistem.addSection(rYp, 4);

        Paragraph datosRyP = new Paragraph(datos.get(52).toString());
        datosRyP.setIndentationLeft(30);
        reqSistem.add(datosRyP);
//--------------------------------------------------------------------------------------------//
        Paragraph cicle = new Paragraph("Sustentabilidad del ciclo de vida del sistema", blueFont);
        cicle.setIndentationLeft(25);
        reqSistem.addSection(cicle, 4);
        
        Paragraph datosCicle = new Paragraph(datos.get(53).toString());
        datosCicle.setIndentationLeft(30);
        reqSistem.add(datosCicle);
//--------------------------------------------------------------------------------------------//
        Paragraph oper = new Paragraph("Operaciones del sistema", blueFont);
        oper.setIndentationLeft(25);
        Section opSis = reqSistem.addSection(oper, 3);
//------------------------------------*********----------------------------------------------//
        Paragraph fh = new Paragraph("Factores humanos del sistema", darkGreyFont);
        fh.setIndentationLeft(30);
        Section facH = opSis.addSection(fh, 4);
   
        Paragraph ps = new Paragraph("Personal de soporte informático", greyFont);
        ps.setIndentationLeft(40);
        facH.addSection(ps, 5);

        Paragraph datosPs = new Paragraph(datos.get(54).toString());
        datosPs.setIndentationLeft(45);
        facH.add(datosPs);
//------------------------------------*********----------------------------------------------//
        Paragraph pe = new Paragraph("Personal de emergencias", greyFont);
        pe.setIndentationLeft(40);
        facH.addSection(pe, 5);

        Paragraph datosPe = new Paragraph(datos.get(55).toString());
        datosPe.setIndentationLeft(45);
        facH.add(datosPe);
//------------------------------------*********----------------------------------------------//
        Paragraph pi = new Paragraph("Personal invitado", greyFont);
        pi.setIndentationLeft(40);
        facH.addSection(pi, 5);

        Paragraph datosPi = new Paragraph(datos.get(56).toString());
        datosPi.setIndentationLeft(45);
        facH.add(datosPi);
//------------------------------------*********----------------------------------------------//
        Paragraph pg = new Paragraph("Personal de gestión de servicios de control", greyFont);
        pg.setIndentationLeft(40);
        facH.addSection(pg, 5);

        Paragraph datosPg = new Paragraph(datos.get(57).toString());
        datosPg.setIndentationLeft(45);
        facH.add(datosPg);
//------------------------------------*********----------------------------------------------//
        Paragraph pgest = new Paragraph("Personal de gestión", greyFont);
        pgest.setIndentationLeft(40);
        facH.addSection(pgest, 5);

        Paragraph datosPgest = new Paragraph(datos.get(58).toString());
        datosPgest.setIndentationLeft(45);
        facH.add(datosPgest);
//------------------------------------*********----------------------------------------------//
        Paragraph po = new Paragraph("Personal de operación", greyFont);
        po.setIndentationLeft(40);
        facH.addSection(po, 5);

        Paragraph datosPo = new Paragraph(datos.get(59).toString());
        datosPo.setIndentationLeft(45);
        facH.add(datosPo);
//------------------------------------*********----------------------------------------------//
        Paragraph pseg = new Paragraph("Personal de seguridad", greyFont);
        pseg.setIndentationLeft(40);
        facH.addSection(pseg, 5);

        Paragraph datosPseg = new Paragraph(datos.get(60).toString());
        datosPseg.setIndentationLeft(45);
        facH.add(datosPseg);
//------------------------------------*********----------------------------------------------//
        Paragraph psop = new Paragraph("Personal de soporte", greyFont);
        psop.setIndentationLeft(40);
        facH.addSection(psop, 5);

        Paragraph datosPsop = new Paragraph(datos.get(61).toString());
        datosPsop.setIndentationLeft(45);
        facH.add(datosPsop);
//-----------------------------------------------------------------------------------------//
        Paragraph fsist = new Paragraph("Fidelidad del sistema", darkGreyFont);
        fsist.setIndentationLeft(30);
        opSis.addSection(fsist, 4);

        Paragraph datosFsist = new Paragraph(datos.get(62).toString());
        datosFsist.setIndentationLeft(35);
        opSis.add(datosFsist);
//----------------------------------------------------------------------------------------//
        Paragraph sistS = new Paragraph("Sistema de soporte", darkGreyFont);
        sistS.setIndentationLeft(30);
        opSis.addSection(sistS, 4);

        Paragraph datosS = new Paragraph(datos.get(63).toString());
        datosS.setIndentationLeft(35);
        opSis.add(datosS);
//---------------------------------------------------------------------------------------//
        Paragraph cpS = new Paragraph("Características de Performance del sistema", blueFont);
        cpS.setIndentationLeft(25);
        reqSistem.addSection(cpS, 3);

        Paragraph datosCPS = new Paragraph(datos.get(64).toString());
        datosCPS.setIndentationLeft(30);
        reqSistem.add(datosCPS);
//--------------------------------------------------------------------------------------//
        Paragraph sistSeg = new Paragraph("Sistema de seguridad", blueFont);
        sistSeg.setIndentationLeft(25);
        reqSistem.addSection(sistSeg, 3);

        Paragraph datosSistSeg = new Paragraph(datos.get(65).toString());
        datosSistSeg.setIndentationLeft(30);
        reqSistem.add(datosSistSeg);

        document.add(capitulo3);

//CAPITULO 4
/********************************************************************************************/
        Chapter capitulo4 = new Chapter(new Paragraph("Indice y Apendice", subFont), 4);

//-------------------------------------------------------------------------------------//
        Paragraph indice = new Paragraph("Índice", blueFont);
        indice.setIndentationLeft(10);
        capitulo4.addSection(indice, 2);

        Paragraph datosIndice = new Paragraph(datos.get(66).toString());
        datosIndice.setIndentationLeft(20);
        capitulo4.add(datosIndice);
//------------------------------------------------------------------------------------//
        Paragraph apendice = new Paragraph("Apendice", blueFont);
        apendice.setIndentationLeft(10);
        capitulo4.addSection(apendice, 2);

        Paragraph datosApendice = new Paragraph(datos.get(67).toString());
        datosApendice.setIndentationLeft(20);
        capitulo4.add(datosApendice);

        document.add(capitulo4);
    }
}//Fin clase
